import mx.controls.*;

private function editLocaleBrowseClick():void {
	var myFile:File = new File();
	 
	myFile.addEventListener(Event.SELECT, editLocaleNewFile);
	myFile.browseForSave("Choose locale file name");
}

private function editLocaleNewFile(event:Event):void 
{
    var newFile:File = event.target as File;
    
    if (newFile.extension != "properties") {
    	newFile = new File(newFile.nativePath + ".properties");
    }
    
    if (newFile.exists) {
    	Alert.show("File already exists and will be overwritten when generated.");
    }
    
    elFilename.text = newFile.nativePath;
}

private function changeLocale():void {
	project.locale.(@code == opLocaleDG.selectedItem.@code).@file = elFilename.text;
	projectModified = true;
	currentState = "openProject";
}

private function editLocaleEnterState():void {
	elFilename.text = opLocaleDG.selectedItem.@file;
}